<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .active {
      color: red;
    }
  </style>
</head>
<body>
  <div id="app">
    <ul>
      <li 
        v-for="(item, index) in list" 
        :class="{ active: activeNum === index }"
        v-on:click="fn(index)"
      >
        {{ item }}
      </li>

      <!-- <li :class="{ active: activeNum === 1 }">11111</li>
      <li :class="{ active: activeNum === 2 }">22222</li>
      <li :class="{ active: activeNum === 3 }">33333</li> -->
    </ul>
  </div>

  <script src="../vue3.js"></script>
  <script>
    const {createApp} = Vue;
    createApp({
      data() {
        return {
          list: ["11111", "22222", "33333"],
          activeNum: 0
        }
      },
      methods: {
        fn(i) {
          this.activeNum = i;
        }
      }
    }).mount("#app");
  </script>
</body>
</html>